home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4669 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  846 b 

  1. Path: news.uni-jena.de!news
  2. From: mkt@isun04.inf.uni-jena.de (Tilo Koerbs)
  3. Newsgroups: comp.lang.c++
  4. Subject: SPARCompiler error
  5. Date: 31 Jan 1996 15:21:34 GMT
  6. Organization: Lehrstuhl fuer Rechnerarchitektur- und kommunikation, FSU Jena
  7. Message-ID: <4eo1du$qlr@fsuj01.rz.uni-jena.de>
  8. Reply-To: mkt@isun04.inf.uni-jena.de
  9. NNTP-Posting-Host: isun07.inf.uni-jena.de
  10.  
  11. The SPARCompiler 4.0x has a nice incompatibility between
  12. C++ and ANSI-C 'optimized away'. The C++ compiler behaves
  13. like an ANSI-C compiler here:
  14.  
  15. cout << (1 ? 'a' : 'b') << endl;
  16.  
  17. Question: What is the output on the screen?
  18. In C++ it is an 'a'.
  19. Not so the SPARCompiler. It prints out a '97'!!!
  20. This is exactly what ANSI-C compiler do! They do an integral promotion
  21. on the second and third operand of ?:
  22. C++ does no promotion.
  23. Who can tell these SPARCompiler-Guys about the error?
  24.  
  25.  
  26.